package com.text.day1_3;

import java.util.Scanner;

public class XiaoLian {
    public static void main(String[] args) {
        System.out.println("水仙花数");
        for (int i = 100; i < 1000; i++) {
            if (Math.pow(i / 100,3) + Math.pow((i / 10) % 10,3) + Math.pow(i % 10,3) == i)
                System.out.println(i);
        }
        System.out.println("输入一个整数");
        Scanner scanner = new Scanner(System.in);
        int shu = scanner.nextInt();
        int que = 0;
        while (shu != 0){   //这里面只能布尔类型
            que += shu % 10;
            shu /= 10;
        }
        System.out.println("各个数之和:" + que);
        System.out.println("第三个问");
        for (int i = 1; i < 30; i++) {
            for (int j = 1; j < 30; j++) {
                for (int k = 1; k < 30; k++) {
                    if(i * 3 + j * 2 + k == 50 && i + j + k == 30)
                        System.out.println("男：" + i + " 女：" + j + " 小孩：" + k + "\t");   //假定三个都有
                }
            }
        }
    }
}
